# Importing Data
FRANCE <- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "K1:K239")

# Checking the Imported Data
View(FRANCE)
# Creating Time Series Data
FRANCE_ts <- ts(FRANCE, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
FRANCE_ts
sum(is.na(FRANCE_ts))
library(forecast)
FRANCE_ts <- tsclean(FRANCE_ts)
FRANCE_ts

# Identification: Plotting the Time Series Data
plot(FRANCE_ts)

# Estimating the appropriate model
FRANCE_ts_model <- auto.arima(FRANCE_ts)
FRANCE_ts_model

# Forecasting
options(max.print=1000000)
FRANCE_ts_forecast <- forecast (FRANCE_ts_model, level=c(95), h=255)
plot(FRANCE_ts_forecast)
FRANCE_ts_forecast             

# Exporting
write.table(FRANCE_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/FRANCE_TSA.csv", sep=",")
